/**
 * 历史版本更新信息 引用JS文件
 */

//初始化页面加载
$(function(){
	pageList(1);
});

function pageList(){
	
	$.ajax({
		url : "../self/versiondInfo",
		type : "post",
		dataType : "json",
		data : {"versionUuid":versionUuid},
		success : function(data){
			console.log(data);
			
			if(data == null || data == -1){
				return;
			}
			
			$("#sp_org").html(data.obj.OWNER_DEPTNAME);
			$("#sp_name").html(data.obj.PERSON_LIABLE_NAME);
			$("#sp_time").html(okrTime(data.obj.O_YEAR,data.obj.O_QUARTER,data.obj.O_MONTH));
			$("#sp_code").html(data.obj.O_CODE);
			$("#sp_post").html(data.obj.PERSON_LIABLE_POSTNAME);
			$("#sp_reason").html(data.obj.OKR_CHANGE_REASON);
			$("#sp_content").html(data.obj.OKR_CHANGE_CONTENT);
			$("#sp_definition").html(data.obj.O_CODE+"："+data.obj.O_DEFINITION);
			
			if(data.versiond.length == 0){
				$("#list").html('<div class="mui-card" style=""><div class="mui-card-footer"><p class="index-status" style="text-align:center; width:100%;margin-top:3%;">暂无信息</p></center></div>');
				return;
			}
			
			$("#list").html("");
			var str = "";  
			$.each(data.versiond,function(n,value) {
				str += '<div class="mui-card" style="">';
				str += '<div class="mui-card-header">'+value.KR_CODE+'<span style="float:right;">评分：';
				str += krColor(value.KR_SCORE_SUPERIOR)+'</span></div>';
				str += '<div class="mui-card-content">';
				str +='<div class="mui-card-content-inner re-bold">';
				str += '<p><span>定义：</span>'+value.KR_DEFINITION+'</p>';
				str += '<p><span>行动计划：</span>'+value.ACTION_PLAN+'</p>';
				str += '</div>';
				str += '</div>';
				str += '</div>';
			});  
			
			$("#list").html(str);
		}
	});
}